<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>菜单列表</title>
    <link rel="stylesheet" type="text/css" th:href="@{/js/layui/css/layui.css}" media="all">
    <link rel="stylesheet" type="text/css" th:href="@{/css/fyn/style.css/}" media="all">
    <link rel="stylesheet" type="text/css" th:href="@{/css/fyn/my.css/}" media="all">

</head>
<body class="body">
<div class="my-btn-box layui-form">
    <span class="fr">
        <div class="layui-input-inline">
             <label class="layui-form-label">IP</label>
            <div class="layui-input-block">
                <input type="text" autocomplete="off" name="ip" placeholder="请输入IP..." class="layui-input height33">
            </div>
        </div>
        <div class="layui-input-inline">
            <label class="layui-form-label">类型</label>
            <div class="layui-input-block">
		      <select name="type" id="typeId">
	      		<option value="">请选择</option>
	      		<option value="0">注册</option>
	      		<option value="1">登录</option>
              </select>
            </div>
        </div>
        <button class="layui-btn layui-btn-sm" id="search"><i class="layui-icon">&#xe615;</i></button>
    </span>
</div>

<!-- 表格 -->
<div id="dateTable" lay-filter="event"></div>
<div class="height50"></div>
<script th:src="@{/js/layui/layui.js}"></script>
<script th:src="@{/js/fyn/index.js}"></script>
<script th:src="@{/js/fyn/my.js}"></script>
<script type="text/javascript" th:src="@{/js/vip/vip_comm.js}"></script>
<script type="text/javascript" th:src="@{/js/vip/vip_table.js}"></script>
<script type="text/javascript" th:inline="javascript">

    // layui方法
    layui.use(['table', 'form', 'element', 'laypage', 'layer', 'vip_table'], function () {
        // 操作对象
        var form = layui.form
            , table = layui.table
            , $ = layui.jquery;

        // 表格渲染
        var tableIns = table.render({
            elem: '#dateTable'                  //指定原始表格元素选择器（推荐id选择器）
            , height: "full"    //容器高度
            // , skin: 'line'
            , even: 'true'
            , cols: [[                  //标题栏
                {field: 'id', title: 'ID', minWidth: 50, sort: true, align: 'center'},
                {field: 'nickName', title: '用户名称', minWidth: 100, sort: true, align: 'center'},
                {field: 'ip', title: 'ip地址', width: 360, sort: true, align: 'center'}
                ,{field: 'area', title: '地区', align: 'center', minWidth: 100}
                ,{
                    field: 'menu.name', title: '类型', align: 'center', minWidth: 100, templet: function (d) {
                        return d.type == 0 ? "注册" : "登录";
                    }
                }
                , {
                    field: 'user.ctime',
                    align: 'center',
                    title: '创建时间',
                    sort: true,
                    minWidth: "250",
                    templet: function (d) {
                        return new Date(d.ctime).Format("yyyy-MM-dd hh:mm:ss");
                    }
                }
            ]]
            , id: 'dataCheck'
            , url: [[${basePath}]] + '/member/ip/userIpList'
            , method: 'get'
            , page: true
            , limits: [10, 30, 60, 90, 150, 300]
            , toolbar: '#topOperate'
            , limit: 10 //默认采用0
            , loading: true
            // , where: getJson()
            , done: function (res, curr, count) {
                //如果是异步请求数据方式，res即为你接口返回的信息。
                //如果是直接赋值的方式，res即为：{data: [], count: 99} data为当前页数据、count为数据总长度
                $("td[data-field='content']").each(function () {
                    $(this).find(".layui-table-cell").removeClass('layui-table-cell');
                });
            }
        });

        $("#search").click(function () {
            tableIns.reload({
                where: {
                    userIp: $("input[name='ip']").val(),
                    type: $("#typeId").find("option:selected").val()
                },
                page: {
                    curr: 1
                }
            });
        });

        function getJson() {
            return {
                where: {
                    userIp: $("input[name='ip']").val(),
                    type: $("#typeId").find("option:selected").val()
                }
            };
        }
    });
</script>
<!-- 表格操作按钮集 -->
<script type="text/html" id="barOption">
    <i class="layui-icon layui-icon-engine" title="删除用户" style="cursor: pointer" lay-event="delete"></i>
</script>
</body>
</html>